export function createPromise<T>(executor: (resolve: (value: T) => void, reject: (reason?: any) => void) => void) {
    return new Promise<T>((resolve, reject) => {
        executor(resolve, reject)
    })
}

export async function until(fn: () => boolean) {
    while (!fn()) {
        await new Promise(resolve => setTimeout(resolve, 1000))
    }
}